<template>
  <div class="app-container">
    日期：
    <el-date-picker v-model="date" type="date" value-format="yyyy-MM-dd" placeholder="选择要统计的日期"></el-date-picker>
    <el-button type="primary" @click="create">生成</el-button>
  </div>
</template>

<script>
import { countRegister } from '@/api/statistics'
export default {
  data() {
    return {
      date: ''
    }
  },
  methods: {
    async create() {
      const res = await countRegister(this.date)

      if (res.code === 20000) {
        this.$message({
          type: 'success',
          message: '生成统计数据成功~'
        })

        this.$router.push('/statistics/show')
      }
    }
  }
}
</script>
